package cn.cdeden.knowledge.mapper;

import cn.cdeden.knowledge.domain.TeamRelevanceRole;
import cn.cdeden.knowledge.domain.dto.TeamRelevanceRoleDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* @author Chen
* @date 2023-11-29
*/
@Repository
public interface TeamRelevanceRoleMapper extends BaseMapper<TeamRelevanceRole> {

    void updateRole(String treeNodeId, Long objectId,Integer objectType, String roleId);

    void replaceOwnerPerm(Integer teamId, Long userId);

    List<TeamRelevanceRoleDto> queryByTreeNodeId(@Param("treeNodeId") String treeNodeId, @Param("nickName") String nickName, @Param("startPage") Integer startPage, @Param("endPage") Integer endPage, @Param("objectTypes") List<String> objectTypes, @Param("roleId") List<String> roleId);

    int queryCountByTreeNodeId(@Param("treeNodeId") String treeNodeId, @Param("nickName") String nickName, @Param("objectTypes") List<String> objectTypes,@Param("roleId") List<String> roleId);

    void removeByTreeNodeId(String treeNodeId);

    List<TeamRelevanceRole> getRelevanceRoleByTreeNodeId(String treeNodeId);

    List<TeamRelevanceRole> queryByOwner(String teamId,String objectId);

    void replaceOwnerOtherPerm(String teamId, String oldOwner, String newOwner);

    void removeExtend(Long treeNodeId, Long objectId);

    void removeByObjectIds(Integer teamId, Integer permTypeCode, Long objectId);
}
